package org.lys.annotation;

import java.util.Date;

public class Person {
	
	private int age;
	
	private Date birthday;
	
	public Person() {
		super();
	}

	public Person(int age, Date birthday) {
		this.age = age;
		this.birthday = birthday;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	@Deprecated
	public String print(){
		return "print";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + age;
		result = prime * result
				+ ((birthday == null) ? 0 : birthday.hashCode());
		return result;
	}

	/**
	 * 注意在重写equals方法的时候，比较的参数应该是Object 类型，因为Object类中的equals方法是Ojbect类型
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Person other = (Person) obj;
		if (age != other.age)
			return false;
		if (birthday == null) {
			if (other.birthday != null)
				return false;
		} else if (!birthday.equals(other.birthday))
			return false;
		return true;
	}

}
